from core.basehandler import BaseHandler
from core.room import Room
from core.action import Action
from core.support import get_game

class ThirdFloorHallway(Room):
    def __init__(self, room_id):
        Room.__init__(self, room_id)    # do basic initialization for every room
        
        # add inventory items - NONE ARE NEEDED FOR THE HALLWAY

        # build list of actions
        self.add_action(GoToGradLounge)
        self.add_action(GoToCompLab)
        self.add_action(GoToLibrary)
        self.add_action(GoToSecondFloor)
        self.add_action(GoToLocker)
        self.add_action(GoToLookDownThree)
        
    # return description of room.
    def get_description(self):
        return "You are in the hallway on the third floor.  Where to next? The world is your oyster, if oysters still exist in Zom-B-School.  A student ID would get you even more oysters."
    
    # return image of room
    def get_image(self):
        return 'Hallways2.jpg'

    def is_read(self):
        game = get_game()
        
        player = game.get_player()
        if player.has_status('note_read'):
            return True
        return False
    
    def is_inhand(self):
        game = get_game()
        
        player = game.get_player()
        if 'StudentID' in player.inventory:
            return True
        return False
    
class ThirdFloorHallwayHandler(BaseHandler):
    
    # return class to use to create a new instance of this room
    def get_room_class(self):
        return ThirdFloorHallway

# define actions for this room
    
class GoToGradLounge(Action):
    def __init__(self):
        Action.__init__(self, "GoToGradLounge")
    
    def get_description(self):
        return "Head to Student Lounge"
    
    def get_destination(self):
        return 'gradlounge'
    
    def get_method(self):
        return "get"
    
    def is_enabled(self):
        if self.room.is_inhand():
            return True
        else: 
            return False 

class GoToCompLab(Action):
    def __init__(self):
        Action.__init__(self, "GoToCompLounge")
    
    def get_description(self):
        return "Head to Computer Lab"
    
    def get_destination(self):
        return 'computerlab'
    
    def get_method(self):
        return "get"

    def is_enabled(self):
        if self.room.is_inhand():
            return True
        else: 
            return False  
        
class GoToLibrary(Action):
    def __init__(self):
        Action.__init__(self, "GoToLab")
    
    def get_description(self):
        return "Head to Library"
    
    def get_destination(self):
        return 'library'
    
    def get_method(self):
        return "get"
    
class GoToSecondFloor(Action):
    def __init__(self):
        Action.__init__(self, "GoToSecondFloor")
    
    def get_description(self):
        return "Go to Second Floor. Be careful!"
    
    def get_destination(self):
        return 'secondfloorhallway'
    
    def get_method(self):
        return "get"

class GoToLocker(Action):
    def __init__(self):
        Action.__init__(self, "GoToLocker")
    
        # has the crumplednote been read?
    def is_enabled(self):
        if self.room.is_read():
            return True
        else: 
            return False    
    
    def get_description(self):
        return "Go to Locker"
    
    def get_destination(self):
        return 'locker'
    
    def get_method(self):
        return "get"

class GoToLookDownThree(Action):
    def __init__(self):
        Action.__init__(self, "GoToLookDownThree") 
    
    def get_description(self):
        return "Look over the Edge"
    
    def get_destination(self):
        return 'lookdown3'
    
    def get_method(self):
        return "get"
    